<html>
<head>
    <title>Browse Directories</title>
</head>

<body>
    <h1>Browsing</h1>
    <?php
    
    require_once('../util.php');

    /*
    $current_dir = '../';
    $dir = opendir($current_dir);

    preEcho("uploaded directory is $current_dir");
    preEcho("Directory Listing: ");

    while (false !== ($file = readdir($dir))) {
        if ($file != "." && $file != "..") {
            preEcho("$file");
        }
    }

    closedir($dir);
     */

    preEcho(getcwd());

    $path = '/';
    $dirO = dir($path);
    while (false != ($file = $dirO->read())) {
        if ($file != '.' && $file != '..') {
            preEcho($file);
        }
    }
    $dirO->close();
    ?>
</body>
</html>
